package com.guochenglang.www.dao.impl;

import com.guochenglang.www.dao.TracesDao;
import com.guochenglang.www.pojo.Traces;
import com.guochenglang.www.util.GetTable;
import com.guochenglang.www.util.connect.JdbcUtil;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * 浏览记录表的Dao层
 *
 * @author GuoChenglang
 */
public class TracesDaoImpl implements TracesDao {
    /**
     * 表名
     */
    private static final String TABLE = GetTable.getTable(Traces.class);

    @Override
    public ArrayList<Traces> tracesSelect(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectMax(TABLE, traces);
    }

    @Override
    public ArrayList<Traces> tracesSelectByLimit(int page, int num, Traces traces, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectByLimit(TABLE, page, num, traces, order, mode);
    }

    @Override
    public int insertTraces(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.insert(TABLE, traces);
    }

    @Override
    public int deleteTraces(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.delete(TABLE, traces);
    }
}
